package com.zylix.simon.drawings.notes;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;

public class BitmapView extends View {

	Bitmap mBitmap = null;
	public BitmapView(Context context, Bitmap bm) {
	super(context);
	mBitmap = bm;
	}

	@Override
	protected void onDraw(Canvas canvas) {
	// called when view is drawn
	Paint paint = new Paint();
	paint.setFilterBitmap(true);
	// The image will be scaled so it will fill the width, and the
	// height will preserve the image’s aspect ration
	//double aspectRatio = ((double) mBitmap.getWidth()) / mBitmap.getHeight();
	//Rect dest = new Rect(0, 0, this.getWidth(),(int) (this.getHeight() / aspectRatio));
	Rect dest = new Rect(0, 0, this.getWidth(), this.getHeight());
	canvas.drawBitmap(mBitmap, null, dest, paint);	
	}
}
